package net.cyndeline.fov.mrpas

/**
 * Stores angles that are blocked in a quadrant half.
 */
trait ObstructedAngles {
  
  /**
   * Adds a new blocked angle between two points.
   * @param start A value between 0 and 1f.
   * @param stop A value between 0 and 1f. Must be higher than start.
   * @return True if the angle were added, false if start was higher than stop.
   */
  def addObstructedAngle(start: Float, stop: Float): Boolean
  
  /**
   * Checks if an angle is obstructed.
   * 
   * @param angle The angle to check whether or not there's an angle
   * 			  blocking it.
   * @param anglesToCheck The number of angles to check for a blocking angle.
   * This is needed since every blocking angle lies between 0 and 1f, making it
   * impossible to tell from the angle alone whether or not it belongs to an
   * object below or above the map position being examined. However, since every
   * angle is added in the order the obstacles are found (bottom up, starting at
   * the viewers position), any angle that is found within the number of
   * obstacles found up until the line that the examined position is on is
   * sure to belong to an obstacle below that line.
   */
  def isObstructed(angle: Float, anglesToCheck: Int): Boolean
}